package com.candy.control;



import org.springframework.web.servlet.ModelAndView;
import org.springframework.web.servlet.mvc.Controller;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;


public class LoginController implements Controller {
    @Override
    public ModelAndView handleRequest(HttpServletRequest request, HttpServletResponse response) throws Exception {
        System.out.println("已接收前端发送过来的请求");
//        接受前端传递过来的参数
        String username=request.getParameter("username");
        ModelAndView mv=new ModelAndView();
//        在这里进行视图地址的拼接
//        拼接后的完整路径为：
//        /WEB-INF/pages/welcome.jsp
        mv.setViewName("welcome");
        mv.addObject("username",username);
        return mv;
    }
}
